IF EXISTS(SELECT name FROM sysobjects
      WHERE name = 'pInProdDetail_Get' AND type = 'P')
   DROP PROCEDURE pInProdDetail_Get
GO

CREATE PROCEDURE dbo.pInProdDetail_Get
	@inProdPaperId AS INT
AS


/*______________________ CONSTANT DECLARATIONS _________________________*/

  

/*______________________ VARIABLE DECLARATIONS _________________________*/

  
/*_______________________________ INIT _________________________________*/


/*________________________ VALIDATE PARAMETERS _________________________*/
	
/*_______________________________ MAIN _________________________________*/
	
	SELECT 
		[Name] = p.[Name],
		ProductId = p.Id, 
		Amount = pd.Amount,
		ProductDetailId = pd.Id,
		InputPrice = pd.InputPrice,
		InOutProdPaperId = pd.InOutProdPaperId
	FROM InOutProdDetail pd
	INNER JOIN Product p 
		ON pd.ProductId = p.Id
	WHERE pd.InOutProdPaperId = @inProdPaperId
	ORDER BY pd.Id
/*___________________________ ERROR HANDLER ____________________________*/



